package com.zho.web.tag;

import javax.servlet.jsp.JspException;

import com.zho.common.velocity.VelocityTemplate;
import com.zho.web.common.Constants.VelocityTemplateKey;

import org.apache.log4j.Logger;
import org.apache.velocity.context.Context;

@SuppressWarnings("serial")
public class SubscribeTag extends BasicVelocityTag {  
    private static Logger logger = Logger.getLogger(SubscribeTag.class);
    
    private String subscribeType;

	/*
     * (non-Javadoc)
     * 
     * @see javax.servlet.jsp.tagext.TagSupport#doStartTag()
     */
    public int doStartTag() throws JspException {
    	try {
            pageContext.getOut().print(generate());
        } catch (Exception e) {
            if (logger.isDebugEnabled()) {
                logger.debug("doStartTag()", e);
            }
        }
        return SKIP_BODY;
    }

	@Override
	protected String getTemplatePath() {
		String tmpName = VelocityTemplate.getTempName(VelocityTemplateKey.SUBSCRIBE_TAG);
		return this.pageContext.getServletContext().getRealPath(tmpName);
	}

	@Override
	protected void populateContextParam(Context context) throws Exception {
		// TODO Auto-generated method stub
	}

	public String getSubscribeType() {
		return subscribeType;
	}

	public void setSubscribeType(String subscribeType) {
		this.subscribeType = subscribeType;
	}
}
